<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .box {
        width: 300px;
        padding: 20px;
        background-color: rgb(243, 239, 239);
        box-shadow: 10px 10px 10px rgba(0, 0, 0, 0.3);
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        transition: all 1s;
        text-align: center;
      }
      
      input {
        width: 290px;
        height: 30px;
        margin: 10px auto;
      }
      button {
        width: 150px;
      }
      .input1{
        position: relative;
      }
      span {
        width: 30px;
        height: 30px;
        background-color: aqua;
        z-index: 99;
        border-radius: 50%;
        text-align: center;
        line-height: 23px;
        font-size: 30px;
        color: red;
        position: absolute;
        top: 173px;
        right: 27px;
        cursor: pointer;
      }
    </style>
  </head>
  <body>
    <div class="box">
      <h1>登录页面</h1>
      <input type="text" placeholder="请输入用户名" /> <br />
      <input type="password" placeholder="请输入密码" class="input1">
      <span>x</span>
      </input> <br>
      <button>登录</button>
    </div>
    <script>
   let span=      document.querySelector("span")
  let input=  document.querySelector(".input1")
  let flag=0;
   span.onclick=function(){
    if(flag==0){
      input.type="text"
        flag=1
    }else {
     
    input.type="password"
    flag=0
   }
}
    </script>
  </body>
</html>
